//
//  HEAIMultiSelectCell.m
//  HealthFamily
//
//  Created by 吴欧 on 2020/11/23.
//  Copyright © 2020 honglutec. All rights reserved.
//

#import "HEAIMultiSelectCell.h"

@interface HEAIMultiSelectCell ()
@property(nonatomic, strong) HEAISubItemModel *model;

@property (nonatomic, strong) UIImageView *selectBtn;

@property (nonatomic, strong) UILabel *titleLb;

@end

@implementation HEAIMultiSelectCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        [self initUI];
    }
    return self;
}

- (void)initUI {
 
    _selectBtn = [UIImageView new];
    _selectBtn.image = IMAGE_NAMED(@"check_box_unsel");
    _selectBtn.userInteractionEnabled = NO;
    [self.contentView addSubview:_selectBtn];
 
    
    _titleLb = [UILabel new];
    _titleLb.text = @"-";
    _titleLb.font = DYFont(16);
    _titleLb.numberOfLines = 0;
    [self.contentView addSubview: _titleLb];
     
    [_selectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(_titleLb);
        make.left.equalTo(self.contentView).mas_offset(0);
        make.width.height.mas_offset(25);
    }];
    
    [_titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).mas_offset(15);
        make.left.equalTo(_selectBtn.mas_right).mas_offset(10);
        make.right.equalTo(self.contentView).mas_offset(-0);
        make.bottom.equalTo(self.contentView).mas_offset(-10);
    }];
}

- (void)configCellWithModel:(HEAISubItemModel *)model {
    
    _model = model;
    _titleLb.text = model.content;
 
    [self changeSelectBtnImage];
}
- (void)changeSelectBtnImage {
    if (_model.isChoose) {
        _selectBtn.image = IMAGE_NAMED(@"check_box_sel");
    }else {
        _selectBtn.image = IMAGE_NAMED(@"check_box_unsel");
    }
}

//- (void)radioSelectedButton:(DLRadioButton *)radioButton {
////    NSInteger index = radioButton.tag;
////    BOOL issel = radioButton.isSelected;
//
//    if ([_delegate respondsToSelector:@selector(selectQuestionItem:)]) {
//        [_delegate selectQuestionItem:_model];
//    }
//}

 

@end
